core: Allow creating tempfile without associated output stream
authorColin Walters <walters@verbum.org>
Fri, 21 Dec 2012 01:49:19 +0000 (20:49 -0500)
committerColin Walters <walters@verbum.org>
Fri, 21 Dec 2012 02:14:27 +0000 (21:14 -0500)
Just slightly more efficient, and we'll use this for spawning curl to
a tempfile.

src/libostree/ostree-core.c

index 0fb2b406a017f054adbd225e7a32aab2978c120c..6e494d4c39bd4bce0e9b905c2689ed521f09720f 100644 (file)
@@ -1367,9 +1367,12 @@ ostree_create_temp_regular_file (GFile            *dir,
                                            &ret_file, cancellable, error))
     goto out;
   
-  ret_stream = (GOutputStream*)g_file_append_to (ret_file, 0, cancellable, error);
-  if (ret_stream == NULL)
-    goto out;
+  if (out_stream)
+    {
+      ret_stream = (GOutputStream*)g_file_append_to (ret_file, 0, cancellable, error);
+      if (ret_stream == NULL)
+        goto out;
+    }
   
   ret = TRUE;
   ot_transfer_out_value(out_file, &ret_file);